<template>
  <v-chart class="chart" :option="option" autoresize />
</template>

<script setup>
import { use } from "echarts/core";
import { CanvasRenderer } from "echarts/renderers";
import { LineChart } from "echarts/charts";
import { TitleComponent, TooltipComponent, LegendComponent, GridComponent, ToolboxComponent } from "echarts/components";
import VChart from "vue-echarts";
import { defineProps } from "vue";

// 按需引入 ECharts 的模块，可以减小打包体积
use([CanvasRenderer, LineChart, TitleComponent, TooltipComponent, LegendComponent, GridComponent, ToolboxComponent]);

// 定义 props，接收父组件传递过来的 ECharts 配置项
const props = defineProps({
  option: {
    type: Object,
    required: true,
  },
});
</script>

<style scoped>
.chart {
  width: 100%;
  height: 100%;
}
</style>
